package chapter04.Example19;
class Animal{
    //重写Object类的toString()方法
    public String toString(){
        return "这是一个动物";
    }
}
public class Example19 {
    public static void main(String[] args) {
        Animal animal = new Animal();             //创建Animal对象
        System.out.println(animal.toString());    //调用toString()方法并打印
    }
}
